package homewoek12月30号.homework.h1h2;

import java.util.HashMap;

public class H1 {
    public static void main(String[] args) {
        int[] arr={22,19,12,38,56,76,43,12,34,54,23,54,22,12,53};
        HashMap map = run(arr);
        for (Object o : map.keySet()) {
            System.out.println("最小值索引值为"+o+",值为"+map.get(o));
        }
    }

    private static HashMap run(int[] arr) {
        HashMap<Integer, Integer> map = new HashMap<>();
        int min=arr[0];
        int index=0;
        for (int i = 0; i < arr.length; i++) {
            if (min>=arr[i]){
                min=arr[i];
                index=i;
            }
        }
        map.put(index,min);
        return map;
    }
}
